For instance, in sending and collecting measured data obtained by a portable measuring unit at a host system located remote from this measuring unit, the measured data needs to be transferred as accurately as possible to the host system from the measuring unit. As an example of a system for transferring measured data obtained by a measuring unit to a host system in this manner, there is proposed a system as illustrated in FIG. 3.
A measuring unit 1 measures physical quantities such as the weight and length of an object to be measured. Measured data consisting of analog values measured by this measuring unit 1 is converted by an A/D (analog-digital) converter 2 to be measured data consisting of digital values. This digital measured data is input to a controller 3 which may be constituted by a microcomputer. The controller 3 puts the input digital measured data into a predetermined data frame for transmission, i.e., a transfer frame, to prepare transfer data, subjects this transfer data to frequency shift keying (FSK), and supplies it to a transmitter 4. The transmitter 4 radiotransmits a frequency modulation signal of an FSK signal of the above transfer data. The transmitted frequency modulation signal is received by a receiver 6 provided in a host system 5, and is demodulated into the original transfer data, i.e., transfer frame. The demodulated transfer frame is input to a host computer 7. The host computer 7 extracts measured data included in the input transfer frame and executes various data processes using the measured data.
In this case, data that should be transferred to the host system 5 on a receiver side from the controller 3 on a sender side includes (1) an ID (identification) number for specifying the measuring unit 1, (2) numerical data as measured data, and (3) a carriage return command (CR: carriage return) and (4) paper feed (line feed) command (LF: line feed) which are control data in consideration of a case where a printer is connected to the host system 5, as shown in FIG. 4.
In transferring these data, if numerical data ((2)) expressed in, for example, binary is put as it is in a transfer frame, it may be confused with other transfer control codes. Therefore, the numerical data ((2)) is converted into a character code representing the numeral before being put in the transfer frame. In general, a JIS character code or an ISO character code (the JIS character code is common to the ISO character code for alphanumeric codes and most control characters) standardized by JIS or ISO is used as a character code in this case. This conversion from character data into a character code is executed using a conversion table or the like stored in a memory in advance. More specifically, in the example in FIG. 4, the ID number ((1)) is "3" and it is converted into a JIS character code "00110011" (33 H) (H indicating hexadecimal) which represents "3." The numerical data ((2)) is "236.8," and for each of the characters "2," "3," "6," "." and "8," it is converted into an associated 8-bit character code. "CR" and "LF" as transfer control codes are respectively converted into control characters "00001101" (0D H) and "00001010" (0A H).
FIG. 5 illustrates the data structure of a transfer frame 8 in which the aforementioned various data ((1)-(4)) are included. A header is set at the head of the transfer frame 8, a predetermined start code STX "00000010" (02 H) indicating the start of the transfer frame 8 is set following this header, followed by a character code "3" indicating the ID number and individual character codes, "2," "3," "6," "." and "8," indicating the numerical data, and a predetermined end code ETX "00000011" (03 H) indicating the end of data is set at the end position. A parity code is further located following this end code ETX.
This parity code is a so-called odd horizontal paity code, which is set to "1" when the number of bits "1" at each digit of the individual 8-bit character codes of the individual characters representing numerical data is an even number, and is set to "0" when the number of bits "1" at each digit of the individual codes is an odd number, as shown in FIG. 6. In this example, the parity code is "11101101" (ED H).
Following the parity code are the aforementioned CR code and LF code.
The host computer 7 of the host system 5 which has received thus constructed transfer frame 8 uses the parity code set in this transfer frame 8 to check if an error has occurred in each character code representing each numeral on a transfer path (parity check). Upon completion of the parity check, each character code is decoded to the original numerical data and data processing is executed.
Since the individual transfer control codes such as the start code STX, end code ETX, CR code and LF code are set not to be coincident with ordinary character codes, the host computer 7 on the receiver side can execute processing with sure distinction between these transfer control codes and character codes indicating the ID number and numerical data.
The above-described data transfer system for converting numerical data into character codes and putting them in a transfer frame 8 before transmission still, however, has the following problem.
The value of a parity code set before a CR code that is a transfer control code varies depending on the value of a character code representing numerical data to be transferred, as shown in FIG. 6. Depending on a combination of character codes, therefore, the parity code may become "00001101" which is the same value as the CR code as a transfer control code. When the parity code coincides with the CR code following it, the host computer 7 on the receiver side cannot distinguish the parity code from the CR code, and may execute data processing while considering the parity code is the CR code.
To overcome such a problem, according to the conventional transfer system, when the same code as the CR code appears consecutively, processing is executed, disregarding the subsequent codes. In this case, therefore, no parity code is executed.
If specific data is disregarded under a specific condition, however, a control program, particularly, the one on a receiver side, becomes complicated. If a parity check is not executed for some data, reliability of data would be reduced.
To avoid such a state where some codes are neglected, it is proposed to use a DLE (transfer control expansion) code as shown in FIG. 7. When the same transfer control codes consecutively exist on the transfer frame 8, this DLE code is inserted at their head. In other words, if there is a DLE code, the host computer 7 on the receiver side considers a transfer control code following this DLE code as a normal character code other than a transfer control code. That is, if a parity code coincides with a CR code, the parity code can be processed as an actual parity code because the DLE code is inserted before the parity code.
According to such a data transfer system having a DLE code inserted as needed, however, control programs (control programs on both the sender side and receiver side in this case) become complex as in the aforementioned data transfer system which disregards one code. In addition, the length of the transfer frame 8 varies between the one containing a DLE code and the one without the DLE code. That is, the control programs and circuit arrangements on the sender side and receiver side further become complex.
Therefore, it is significantly difficult to employ the above-described data transfer system in a compact measuring system in which an A/D converter 2 and a controller 3 on a sender side are incorporated (or additionally provided) in a portable measuring unit 1 as shown in FIG. 3.
The present invention has been devised in view of the above situation, and aims at providing a data transfer system which can receive a parity code and a transfer control code with sure distinction therebetween by dividing the individual bits of a computed parity code into plural groups of bits and transferring them with a predetermined code affixed to each bit group, and can simplify a control program and a circuit arrangement without reducing the reliability of data transfer.